feat(plugin): allow compaction hook to replace prompt entirely#5907
Merged
rekram1-node merged 1 commit intoanomalyco:devfrom Dec 23, 2025
Merged
Conversation
Contributor
Author
|
@rekram1-node that was a good point about wanting to replace the prompt, I actually do 😅 this makes it a lot more robust. |
Collaborator
|
/review |
Contributor
|
lgtm |
Contributor
Author
|
@rekram1-node need anything from me here? this one is a huge unlock for me and a better implementation than the first pass 🙏 |
iljod
pushed a commit
to iljod/opencode
that referenced
this pull request
Dec 23, 2025
rekram1-node
pushed a commit
that referenced
this pull request
Dec 27, 2025
anntnzrb
pushed a commit
to anntnzrb/opencode-1
that referenced
this pull request
Dec 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the
experimental.session.compactinghook to support full prompt replacement viaoutput.prompt.This was explicitly called out by @rekram1-node in #5698:
Changes
packages/plugin/src/index.tsprompt?: stringto hook output typepackages/opencode/src/session/compaction.tsoutput.promptif set, otherwise default + contextpackages/web/src/content/docs/plugins.mdxHook Behavior
output.context- appends to default prompt (unchanged)output.prompt- replaces entire prompt (contextignored when set)Example